package com.zrrd.bufferedStream;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * @author WanJl
 * @version 1.0
 * @title BufferedReaderDemo01
 * @description 字符缓冲输入流
 * @create 2024/5/26
 */
public class BufferedReaderDemo01 {
    public static void main(String[] args) {
        //创建基础流-字符输入流对象
        FileReader fr = null;
        //创建处理流对象
        BufferedReader br = null;
        try {
            fr=new FileReader("E:/users/abc.txt");
            br=new BufferedReader(fr);

            //读取一行字符
            //br.readLine();

            String line;
            while((line=br.readLine())!=null){
                System.out.println(line);
            }
        }  catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            try {
                br.close();
                fr.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

        }
    }
}
